/*
 * File: E:\Kan\ARM\Projects\Google Code\Umrichter\trunk\SimulinkModelle\slprj\ert\_sharedutils\div_repeat_sus32_sat_floor.c
 *
 * Code generated for Simulink model 'Fu_RotSpd'.
 *
 * Model version                  : 1.676
 * Simulink Coder version         : 8.2 (R2012a) 29-Dec-2011
 * TLC version                    : 8.2 (Dec 29 2011)
 * C/C++ source code generated on : Sat Jun 15 22:22:09 2013
 */

#include "rtwtypes.h"
#include "rtw_shared_utils.h"

int32_T div_repeat_sus32_sat_floor(uint32_T numerator, int32_T denominator,
  uint32_T nRepeatSub)
{
  int32_T quotient;
  uint32_T quotientNeedsNegation;
  uint32_T absDenominator;
  if (denominator == 0) {
    quotient = MAX_int32_T;

    /* Divide by zero handler */
  } else {
    absDenominator = (uint32_T)(denominator >= 0 ? denominator : -denominator);
    quotientNeedsNegation = (denominator < 0);
    if (quotientNeedsNegation) {
      absDenominator = div_repeat_u32_sat_ceiling(numerator, absDenominator,
        nRepeatSub);
      quotient = absDenominator <= 2147483647U ? -(int32_T)absDenominator :
        MIN_int32_T;
    } else {
      absDenominator = div_repeat_u32_sat(numerator, absDenominator, nRepeatSub);
      quotient = absDenominator <= 2147483647U ? (int32_T)absDenominator :
        MAX_int32_T;
    }
  }

  return quotient;
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
